﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gemli.Data
{
    /// <summary>
    /// Maps a virtual foreign key relationship with CLR type bindings.
    /// </summary>
    /// <remarks>
    /// Used internally to deal with classes that are, for example,
    /// mapped to mapping tables (many-to-many relationships).
    /// <seealso cref="DataModelMap.MappingType{A,B}"/>
    /// </remarks>
    /// <typeparam name="TLeft"></typeparam>
    /// <typeparam name="TRight"></typeparam>
    public class TempMappingTable<TLeft, TRight> : DataModel where TRight : DataModel
    {

        /// <summary>
        /// The local column of the relationship in this binding.
        /// </summary>
        [DataModelFieldMapping]
        public object LeftColumn
        {
            get { return base["LeftColumn"]; }
            set { base["LeftColumn"] = value; }
        }

        /// <summary>
        /// The object or the collection that is related to the <see cref="LeftColumn"/>.
        /// This field declaration is used only for the attribute.
        /// </summary>
        [ForeignDataModel(Relationship = Relationship.ManyToMany)]
        public DataModelCollection<TRight> ForeignModelCollection;
    }

}
